package com.bsoft.exchange.controller.clinicMedication;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bsoft.exchange.domain.ListRosteringDeptDomain;
import com.bsoft.exchange.domain.ListRosteringDomain;
import com.bsoft.exchange.pojo.ListRosteringPojo;
import com.bsoft.exchange.response.ResponseEntity;
import com.bsoft.exchange.service.RecordService;
import com.bsoft.exchange.service.RosteringService;
import com.bsoft.exchange.util.BaseResponse;
import com.bsoft.exchange.util.Constant;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value="rostering")
public class RosteringController {

	@Autowired
	RosteringService rosteringService;
	@Autowired
	RecordService recordService;
	
	@ApiOperation(value = "获取我的排班")
	@RequestMapping(value = "/listRostering",method = RequestMethod.POST,produces = "application/json")
	public ResponseEntity<List<ListRosteringDomain>> listRostering(@RequestBody ListRosteringPojo listRosteringPojo)  {
		ResponseEntity<List<ListRosteringDomain>> entity=new ResponseEntity();
		try{
			BaseResponse<List<ListRosteringDomain>> returnMessage = rosteringService.listRostering(listRosteringPojo);
		
			entity.setCode(returnMessage.getCode());
	    	entity.setMessage(returnMessage.getMessage());
			entity.setData(returnMessage.getData());
		
		}catch(Exception e){
			entity.setCode(Constant.errorTag);
			entity.setMessage(e.getMessage()); 
		}

		return entity;

	}
	
	@ApiOperation(value = "获取科室排班")
	@RequestMapping(value = "/listRosteringDept",method = RequestMethod.POST,produces = "application/json")
	public ResponseEntity<List<ListRosteringDeptDomain>> listRosteringDept(@RequestBody ListRosteringPojo listRosteringPojo)  {
		ResponseEntity<List<ListRosteringDeptDomain>> entity=new ResponseEntity();
		try{
			BaseResponse<List<ListRosteringDeptDomain>> returnMessage = rosteringService.listRosteringDept(listRosteringPojo);
		
			entity.setCode(returnMessage.getCode());
	    	entity.setMessage(returnMessage.getMessage());
			entity.setData(returnMessage.getData());
		
		}catch(Exception e){
			entity.setCode(Constant.errorTag);
			entity.setMessage(e.getMessage()); 
		}

		return entity;

	}
		
}
